import 'package:flutter/material.dart';

enum RequestState {
  Loading,
  Empty,
  Error,
  Success,
}

typedef RequestBuilder<T> = Future<T> Function();
typedef ContentWidgetBuilder<T> = Widget Function(BuildContext context, T value, RetryFunction refreshFunction);
typedef RetryFunction = Function();
typedef ResultChecker<T> = bool Function(T value);

abstract class RequestStateCallback {

  Widget loadingWidget(BuildContext context);

  Widget emptyWidget(BuildContext context, RetryFunction retryFunction);

  Widget errorWidget(BuildContext context, RetryFunction retryFunction,[Object error]);
}
